package com.seuic.hnjiningposapp.hnapps.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.SPStaticUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
import com.seuic.hnjiningposapp.hnapps.base.BaseActivity;
import com.seuic.hnjiningposapp.hnapps.ui.activity.ToHelpFarmersWithdrawMoneyActivity;
import com.socks.library.KLog;

import static com.seuic.hnjiningposapp.hnapps.util.Api.RETURN_CODE_SUCCEED;

/**
 * UI 统一工具类,可以在子线程调用。内部设计UI 得自动会到UI 线程
 *
 * @author rainking
 */
public final class UiTool {

    /**
     * UI 回调
     */
    public interface OnUiToolListener {
        void onSuccess(String data);
    }
    // TODO: 2020/4/8 本行助农取款接口步骤
    //  1、验证是否为本行卡【pcva.trade.b071.01】、
    //  2、银行卡信息查询【pcva.trade.b031.01】
    //  3、黑名单校验【pcva.trade.b072.01】
    //  4、查询备付金账号详情【pcva.trade.b031.01】
    //  5、查询账号本日交易金额和交易次数【pcva.trade.p002.01】
    //  6、提交取款信息【pcva.trade.b052.01】

    /**
     * 验证是否为本行卡
     *
     * @param baseActivity     Activity页面
     * @param AcctNo           账号
     * @param onUiToolListener UI 回调
     */
    public static void getCheckingThisBank(BaseActivity baseActivity, String AcctNo, OnUiToolListener onUiToolListener) {
        KLog.e("验证是否为本行卡", AcctNo);
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getCheckingThisBank(AcctNo), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    // TODO: 2020/4/8 返回的报文没卡号
                    //  验证通过手动加上卡号，方便后面的流程化走下去
                    rspBody.put("AcctNo", AcctNo);
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }

    /**
     * 账户密码验证
     *
     * @param baseActivity
     * @param AcctNo
     * @param pass_word
     * @param onUiToolListener
     */
    public static void getAccountPwdVerificationUiTool(BaseActivity baseActivity,
                                                       String AcctNo,
                                                       String pass_word,
                                                       OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getAccountPwdVerification(AcctNo, pass_word),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");
                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            // TODO: 2020/4/8 返回的报文没卡号
                            //  验证通过手动加上卡号，方便后面的流程化走下去
                            rspBody.put("AcctNo", AcctNo);
                            rspBody.put("AcctNo", pass_word);
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 他行卡转入
     *
     * @param PayeeName        收款方名称
     * @param PayerName        付款方名称
     * @param PosEntryModeCode 服务点输入方式码
     * @param PayeeAcctNo      转入卡号
     * @param PinBlock         密码密文
     * @param TransCurrCode    交易货币代码
     * @param Amount           交易金额
     * @param ThreeTrack       第三磁道数据
     * @param SecondTrack      第二磁道数据
     * @param AcctNo           转出卡号
     * @param ATMSign          ATM标志
     * @return String
     */

    public static void getTransferOfOtherCardsUiTool(BaseActivity baseActivity,
                                                     String PayeeName, String PayerName,
                                                     String PosEntryModeCode, String PayeeAcctNo,
                                                     String PinBlock, String TransCurrCode,
                                                     String Amount, String ThreeTrack,
                                                     String SecondTrack, String AcctNo, String ATMSign,
                                                     OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getTransferOfOtherCards(PayeeName, PayerName, PosEntryModeCode, PayeeAcctNo
                        , PinBlock, TransCurrCode, Amount, ThreeTrack, SecondTrack, AcctNo, ATMSign), new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");
                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            // TODO: 2020/4/8 返回的报文没卡号
                            //  验证通过手动加上卡号，方便后面的流程化走下去
//                            rspBody.put("PayeeName", IDType);
//                            rspBody.put("PayerName", IDNo);
//                            rspBody.put("IDName", IDName);
//                            rspBody.put("AcctNo", AcctNo);
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });
    }

    /**
     * 本代他余额查询
     *
     * @param AcctNo         主账号
     * @param TwoTrack       第二磁道数据
     * @param ThreeTrack     第三磁道数据
     * @param PinBlock       自定义域
     * @param PersonFlg      个人标识码数据
     * @param ProxyBranchFlg 代理机构标识码
     * @param ServiceCode    服务点输入方式码
     * @param SignAgreeNum   签约协议号
     * @param CarNum         发起方卡号
     * @return String
     */

    public static void getCurrentBalanceCheckUiTool(BaseActivity baseActivity,
                                                    String AcctNo, String TwoTrack,
                                                    String ThreeTrack, String PinBlock,
                                                    String PersonFlg, String ProxyBranchFlg,
                                                    String ServiceCode, String SignAgreeNum,
                                                    String CarNum,
                                                    OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getCurrentBalanceCheck(AcctNo, TwoTrack, ThreeTrack, PinBlock, PersonFlg, ProxyBranchFlg
                        , ServiceCode, SignAgreeNum, CarNum),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");
                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            // TODO: 2020/4/8 返回的报文没卡号
                            //  验证通过手动加上卡号，方便后面的流程化走下去
//                            rspBody.put("PayeeName", IDType);
//                            rspBody.put("PayerName", IDNo);
//                            rspBody.put("IDName", IDName);
//                            rspBody.put("AcctNo", AcctNo);
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });
    }

    /**
     * 获取客户信息
     *
     * @param IDType 身份证件类型
     * @param IDNo   身份证件号码
     * @param IDName 证件姓名
     * @param AcctNo 账号
     */
    public static void getCustomerAccountInformationQueryUiTool(BaseActivity baseActivity,
                                                                String IDType,
                                                                String IDNo,
                                                                String IDName,
                                                                String AcctNo,
                                                                OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getCustomerAccountInformationQuery(IDType, IDNo, IDName, AcctNo),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");
                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            // TODO: 2020/4/8 返回的报文没卡号
                            //  验证通过手动加上卡号，方便后面的流程化走下去
                            rspBody.put("IDType", IDType);
                            rspBody.put("IDNo", IDNo);
                            rspBody.put("IDName", IDName);
                            rspBody.put("AcctNo", AcctNo);
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });

    }


    /**
     * 银行卡信息查询
     *
     * @param baseActivity     Activity页面
     * @param AcctNo           账号
     * @param onUiToolListener UI 回调
     */
    public static void getQueryBankCardInfo(BaseActivity baseActivity, String AcctNo, OnUiToolListener onUiToolListener) {

        HttpUtils.postByOkGo(baseActivity, HttpUtils.getQueryBankCardInfo(AcctNo), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    // TODO: 2020/4/8 返回的报文没卡号，
                    //  验证通过手动加上卡号，方便后面的流程化走下去
                    rspBody.put("AcctNo", AcctNo);
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 黑名单校验
     *
     * @param baseActivity     Activity页面
     * @param PayActNo         账号
     * @param PayActName       账户名称
     * @param onUiToolListener UI 回调
     */
    public static void getCheckingBankCardBlacklist(BaseActivity baseActivity, String PayActNo, String PayActName, OnUiToolListener onUiToolListener) {

        HttpUtils.postByOkGo(baseActivity, HttpUtils.getCheckingBankCardBlacklist(PayActNo, PayActName), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");

                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }

    /**
     * 账户限额及交易次数查询
     *
     * @param baseActivity     Activity页面
     * @param AcctNo           账号
     * @param onUiToolListener UI 回调
     */
    public static void getQueryAccountNorm(BaseActivity baseActivity, String AcctNo, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getQueryAccountNorm(AcctNo), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 备付金银行卡信息查询
     *
     * @param baseActivity     Activity页面
     * @param AcctNo           账号
     * @param onUiToolListener UI 回调
     */
    public static void getQueryReserveBankCardInfo(BaseActivity baseActivity, String AcctNo, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getQueryBankCardInfo(AcctNo), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        // TODO: 2020/4/8 备付金查询成功，需要走转账接口
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 转账 本行助农取款  本行现金汇款 他行现金汇款  行内转账  跨行转账  都是一个接口
     *
     * @param baseActivity     Activity页面
     * @param PayActNo         付款账号
     * @param PayActName       付款账户名称
     * @param PayeeActNo       收款账号
     * @param PayeeActName     收款账户名称
     * @param PayeeBankNo      收款行行号
     * @param PinBlock         账户密码
     * @param Amount           金额
     * @param TransferType     转账方式 1：本行 2：跨行
     * @param TradeFee         手续费，没有可以传空
     * @param menuCode         业务菜单Code
     * @param onUiToolListener UI 回调
     */
    public static void getTransfer(BaseActivity baseActivity, String PayActNo, String PayActName,
                                   String PayeeActNo, String PayeeActName,
                                   String PayeeBankNo, String PinBlock,
                                   String Amount, String TransferType, String TradeFee, String menuCode, OnUiToolListener onUiToolListener) {

        HttpUtils.postByOkGo(baseActivity, HttpUtils.getTransfer(PayActNo, PayActName
                , PayeeActNo, PayeeActName, PayeeBankNo, PinBlock, Amount, TransferType, TradeFee, menuCode), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    getElectronicSeal(baseActivity, "1", data1 -> {
                        rspBody.put("ImgBase64", data1);
                        if (onUiToolListener != null) {
                            // TODO: 2020/4/8 交易成功，直接打印小票
                            onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                        }
                    });
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 获取合成电子签章
     *
     * @param baseActivity     Activity页面
     * @param type             业务类型
     * @param onUiToolListener UI 回调
     */
    public static void getElectronicSeal(BaseActivity baseActivity, String type, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getElectronicSeal(type), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    String ImgBase64 = rspBody.getString("rspBody");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(ImgBase64);
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 行名行号查询
     *
     * @param baseActivity     Activity页面
     * @param BankName         银行名称
     * @param onUiToolListener UI 回调
     */
    public static void getQueryAliasBankCardInfo(BaseActivity baseActivity, String BankName, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getQueryAliasBankCardInfo(BankName), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");
                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }


    /**
     * 手续费查询
     *
     * @param baseActivity     Activity页面
     * @param PayAcctNo        付款账号
     * @param PayBankNo        付款账号开户行
     * @param PayeeBankNo      收款行行号
     * @param PayeeAcctNo      收款账号
     * @param Amount           金额
     * @param onUiToolListener UI 回调
     */
    public static void getQueryServiceCharge(BaseActivity baseActivity, String PayAcctNo, String PayBankNo, String PayeeBankNo, String PayeeAcctNo, String Amount, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getQueryServiceCharge(PayAcctNo, PayBankNo, PayeeBankNo, PayeeAcctNo, Amount), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");

                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });
    }

    /**
     * 利率查询
     *
     * @param baseActivity
     * @param onUiToolListener
     */
    public static void getInterestRateInquiryUiTool(BaseActivity baseActivity, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getInterestRateInquiry(), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");

                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

            }
        });
    }

    /**
     * 子账户信息查询
     *
     * @param AcctNo      账号
     * @param PinBlock    密码
     * @param FUNC        功能代码
     * @param ProductCode 综合理财帐户编号(PDT)
     * @return String
     */
    public static void getSubAccountInformationQueryUiTool(BaseActivity baseActivity,
                                                           String AcctNo,
                                                           String PinBlock,
                                                           String FUNC,
                                                           String ProductCode,
                                                           OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getSubAccountInformationQuery(AcctNo, PinBlock, FUNC, ProductCode), new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });

    }

    /**
     * 账户活期明细查询
     *
     * @param AcctNo   账号
     * @param PinBlock 密码
     * @param FUNC     功能代码
     * @param STRDATE  开始日期
     * @param ENDDATE  截止日期
     */
    public static void getAccountCurrentDetailsInquiry(BaseActivity baseActivity,
                                                       String AcctNo,
                                                       String PinBlock,
                                                       String FUNC,
                                                       String STRDATE,
                                                       String ENDDATE,
                                                       OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getAccountCurrentDetailsInquiry(AcctNo,
                        PinBlock,
                        FUNC,
                        STRDATE,
                        ENDDATE), new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });

    }

    /**
     * 账户定期明细查询
     *
     * @param AcctNo      账号
     * @param PinBlock    密码
     * @param FUNC        功能代码
     * @param STRDATE     开始日期
     * @param ENDDATE     截止日期
     * @param PSBK_SQ_NO  本册笔号
     * @param SecondTrack 二磁道
     * @return String
     */
    public static void getAccountDetailsInquiryUiTool(BaseActivity baseActivity,
                                                      String AcctNo,
                                                      String PinBlock,
                                                      String FUNC,
                                                      String STRDATE,
                                                      String ENDDATE,
                                                      String PSBK_SQ_NO,
                                                      String SecondTrack,
                                                      OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getAccountDetailsInquiry(AcctNo,
                        PinBlock,
                        FUNC,
                        STRDATE,
                        ENDDATE,
                        PSBK_SQ_NO,
                        SecondTrack), new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 活期转定期
     *
     * @param TradeType          交易类别
     * @param AcctNo             卡号
     * @param PinBlock           密码
     * @param DrwKind            支取类别
     * @param Amount             支取金额
     * @param DepositTerm        存期
     * @param DepositType        存款种类
     * @param DepositProductCode 存入帐户编号
     * @param SecondTrack        二磁道
     * @param DrawCode           支取帐户编号
     * @param ProductCode        产品编号
     * @param MNG_FLG            理财标志
     * @param TFT_EMP_NO         员工号
     * @param TFT_TD_INT_ACCT_NO 收息账号
     */
    public static void getCurrentTransferUiTool(BaseActivity baseActivity,
                                                String TradeType, String AcctNo,
                                                String PinBlock, String DrwKind,
                                                String Amount, String DepositTerm,
                                                String DepositType, String DepositProductCode,
                                                String SecondTrack, String DrawCode,
                                                String ProductCode, String MNG_FLG,
                                                String TFT_EMP_NO, String TFT_TD_INT_ACCT_NO,
                                                OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getCurrentTransfer(TradeType,
                        AcctNo,
                        PinBlock,
                        DrwKind,
                        Amount,
                        DepositTerm,
                        DepositType,
                        DepositProductCode,
                        SecondTrack,
                        DrawCode,
                        ProductCode,
                        MNG_FLG,
                        TFT_EMP_NO,
                        TFT_TD_INT_ACCT_NO), new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }


    /**
     * 定转活
     *
     * @param AcctNo      账号
     * @param Amount      金额
     * @param PinBlock    账户密码
     * @param SecondTrack 二磁道
     * @param DrawCode    支取帐户编号
     * @param Draw_NO     支取理财帐户笔号
     * @param CertType    证件种类
     * @param IDNO        证件号码
     * @param CustName    客户名称
     * @return String
     */
    public static void getFixedTurnUiTool(BaseActivity baseActivity, String AcctNo, String Amount,
                                          String PinBlock, String SecondTrack,
                                          String DrawCode, String Draw_NO,
                                          String CertType, String IDNO, String CustName,
                                          OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getFixedTurn("",
                "", "", "", "", "", "", "", ""),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });
    }

    /**
     * 周周赢业务，定活自转业务签约查询
     * * @param AcctNo 银行卡号
     *
     * @param baseActivity
     * @param AcctNo
     * @param onUiToolListener
     */
    public static void getSigningInquiryUiTool(BaseActivity baseActivity, String AcctNo,
                                               OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getSigningInquiry(AcctNo), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");

                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
            }
        });

    }

    /**
     * * 周周赢业务，定活自转业务详情查询
     * *
     *
     * @param ProductCode  产品代码
     * @param baseActivity
     */
    public static void getSigningDetailsInquiryUiTool(BaseActivity baseActivity,
                                                      String ProductCode,
                                                      OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getSigningDetailsInquiry(ProductCode),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });
    }

    /**
     * 周周赢业务，定活自转业务签约
     *
     * @param AcctNo       账号
     * @param ProductCode  产品代码
     * @param TransAmt     自动转存基数
     * @param FdepAmt      起存金额
     * @param BalanceLimit 余额下限
     * @param PinBlock     密码
     * @return String
     */
    public static void getSigningBusinessContractUiTool(BaseActivity baseActivity, String AcctNo, String ProductCode,
                                                        String TransAmt, String FdepAmt,
                                                        String BalanceLimit, String PinBlock,
                                                        OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getSigningBusinessContract(AcctNo,
                ProductCode,
                TransAmt,
                FdepAmt,
                BalanceLimit,
                PinBlock), new HttpUtils.BaseApiListener() {
            @Override
            public void onSuccess(String data) {
                JSONObject body = JSON.parseObject(data);
                JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                String returnCode = sysHead.getString("ReturnCode");
                String returnMessage = sysHead.getString("ReturnMessage");

                if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                    JSONObject rspBody = body.getJSONObject("RSP_BODY");
                    if (onUiToolListener != null) {
                        onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                    }
                } else {
                    Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                }
            }

            @Override
            public void onError(String msg) {
                Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

            }
        });
    }

    /**
     * 周周赢业务，定活自转业务解约
     *
     * @param AcctNo   账号
     * @param PinBlock 密码
     * @return String
     */
    public static void getSigningBusinessTerminationUiTool(BaseActivity baseActivity, String AcctNo, String PinBlock,
                                                           OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getSigningBusinessTermination(AcctNo, PinBlock),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });

    }

    /**
     * 电子现金圈存
     *
     * @param FUNC           功能号
     * @param AcctNo         卡号
     * @param ExpdDate       有效期限
     * @param CURR_COD       币别
     * @param SecondMtCon    二磁道
     * @param PinBlock       密码
     * @param Amount         交易金额
     * @param ShopType       商户类别
     * @param ATMNo          ATM编号
     * @param ATMSeqNo       ATM交易序号
     * @param TradeCheckType 交易验证类型 送001
     * @return String
     */
    public static void getElectronicCashTransferUiTool(BaseActivity baseActivity,
                                                       String FUNC,
                                                       String AcctNo,
                                                       String ExpdDate,
                                                       String CURR_COD,
                                                       String SecondMtCon,
                                                       String PinBlock,
                                                       String Amount,
                                                       String ShopType,
                                                       String ATMNo,
                                                       String ATMSeqNo,
                                                       String TradeCheckType,
                                                       OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity,
                HttpUtils.getElectronicCashTransfer(FUNC,
                        AcctNo,
                        ExpdDate,
                        CURR_COD,
                        SecondMtCon,
                        PinBlock,
                        Amount,
                        ShopType,
                        ATMNo,
                        ATMSeqNo, TradeCheckType),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));

                    }
                });

    }

    /**
     * 联网核查
     *
     * @param id   被核对人身份证号码
     * @param name 被核对人姓名
     * @return String
     */
    public static void getNetworkVerificationUiTool(BaseActivity baseActivity,
                                                    String id,
                                                    String name,
                                                    OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getNetworkVerification(id, name),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 银行卡挂失
     *
     * @param AcctNo      账号
     * @param VoucherType 凭证类型
     * @param VoucherNo   凭证号码
     * @param PinBlock    账户密码
     * @param IDType      身份证件类型
     * @param IDNo        身份证件号码
     * @return String
     */
    public static void getLostBankCardUiTool(BaseActivity baseActivity,
                                             String AcctNo,
                                             String VoucherType,
                                             String VoucherNo,
                                             String PinBlock,
                                             String IDType,
                                             String IDNo, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getLostBankCard(AcctNo,
                VoucherType, VoucherNo, PinBlock, IDType, IDNo),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 密码修改
     *
     * @param CardNo       卡号
     * @param OrigPinBlock 账户原密码
     * @param PinBlock     账户密码
     * @param CustName     客户名称
     * @param CustNo       客户号
     * @param IDType       身份证件类型
     * @param IDNo         身份证件号码
     * @param SecondTrack  二磁道
     * @return String
     */
    public static void getChangePasswordUiTool(BaseActivity baseActivity,
                                               String CardNo,
                                               String OrigPinBlock,
                                               String PinBlock,
                                               String CustName,
                                               String CustNo,
                                               String IDType,
                                               String IDNo,
                                               String SecondTrack, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getChangePassword(CardNo,
                OrigPinBlock, PinBlock, CustName, CustNo, IDType, IDNo, SecondTrack),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 更新管理员密码   具体传参数 看你那边 pcva.device.d004.01是正确的
     *
     * @return
     */
    public static void changeOperationPwUiTool(BaseActivity baseActivity,
                                               OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.changeOperationPw(),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 修改主密钥  传参自己写一下
     *
     * @param baseActivity
     * @param onUiToolListener
     */
    public static void changeMainKeyUiTool(BaseActivity baseActivity, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.changeMainKey(),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });
    }

    /**
     * 本机交易汇总查询
     * 传参自己加一下
     */
    public static void getStatisticsUiTool(BaseActivity baseActivity, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.getStatistics(),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });

    }

    /**
     * 本机交易查询
     * 传参自己加一下
     */
    public static void gettransactionqQueryUiTool(BaseActivity baseActivity, OnUiToolListener onUiToolListener) {
        HttpUtils.postByOkGo(baseActivity, HttpUtils.gettransactionqQuery(),
                new HttpUtils.BaseApiListener() {
                    @Override
                    public void onSuccess(String data) {
                        JSONObject body = JSON.parseObject(data);
                        JSONObject sysHead = body.getJSONObject("SYS_HEAD");
                        String returnCode = sysHead.getString("ReturnCode");
                        String returnMessage = sysHead.getString("ReturnMessage");

                        if (returnCode.equals(RETURN_CODE_SUCCEED)) {
                            JSONObject rspBody = body.getJSONObject("RSP_BODY");
                            if (onUiToolListener != null) {
                                onUiToolListener.onSuccess(JSON.toJSONString(rspBody));
                            }
                        } else {
                            Utils.runOnUiThread(() -> baseActivity.showErrorPopup(returnMessage));
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        Utils.runOnUiThread(() -> baseActivity.showErrorPopup(msg));
                    }
                });

    }


}
